home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / Data.cab / _2E6C415DA6A54FAD9837DE0404EFBC31 < prev    next >
Encoding:
Text File  |  2004-05-12  |  760 b   |  39 lines

  1. hlsl("
  2.  
  3. #define NSAMPLES 8
  4.  
  5. #define BLURSTART 1.0f
  6. #define BLURWIDTH -0.08f
  7.  
  8. float4x4 PROJECTION_XFORM;
  9. float4  SCREEN_PARAMS;
  10.  
  11. static const float2 Center = { 0.5, 0.5 };
  12.  
  13. struct VS_OUTPUT
  14. {
  15.        float4 Position    : POSITION;
  16.     float2 TexCoord[NSAMPLES] : TEXCOORD0;
  17. };
  18.  
  19. VS_OUTPUT main( float4 Position : POSITION,
  20.                 float2 TexCoord: TEXCOORD0        )
  21. {
  22.     VS_OUTPUT OUT;
  23.  
  24.     OUT.Position = mul( Position, PROJECTION_XFORM );
  25.  
  26.     // generate texcoords for radial blur (scale around center)
  27.     float2 s = TexCoord + SCREEN_PARAMS.xy*0.5;
  28.     for(int i=0; i<NSAMPLES; i++) {
  29.         float scale = BLURSTART + BLURWIDTH*(i/(float) (NSAMPLES-1));
  30.         OUT.TexCoord[i] = (s - Center)*scale + Center;
  31.     }        
  32.     return OUT;
  33. }
  34.  
  35. ")
  36.  
  37.  
  38.  
  39.